Skip to content

fix: skip cleanup transaction check for cheatcode deployments#399

Open
procdump wants to merge 1 commit intosolana-foundation:mainfrom
procdump:expected_deployment_tx_count_overflow_fix
Open

fix: skip cleanup transaction check for cheatcode deployments#399
procdump wants to merge 1 commit intosolana-foundation:mainfrom
procdump:expected_deployment_tx_count_overflow_fix

Conversation

@procdump
Copy link

@procdump procdump commented Mar 13, 2026

The problem

  • Fix subtraction overflow in deploy_program.rs when instant_surfnet_deployment = true
  • The cheatcode path produces 1 transaction, but only_cleanup_transactions_remaining unconditionally subtracts get_cleanup_transactions_count() + 1 (= 4) from the transaction count, causing a panic
  • Cheatcode deployments have no cleanup transactions (get_cleanup_transactions returns vec![] when do_cheatcode_deploy is true), so the check is skipped entirely for that path

Reproduction

  1. Use in-memory runbooks with instant_surfnet_deployment = true (the default for surfpool start)
  2. Deploy a program built with debug (cargo-build-sbf --debug) → panic at deploy_program.rs:308 with "attempt to subtract with overflow"

The `only_cleanup_transactions_remaining` subtraction overflows when
`instant_surfnet_deployment = true` because the cheatcode path produces
only 1 transaction, and the code unconditionally subtracts 4. Cheatcode
deployments return no cleanup transactions, so the check should not
apply to them.
@procdump
Copy link
Author

This PR came from my attempt to introduce --artifacts-path in surfpool - solana-foundation/surfpool#573

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant